home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / pce32dll.zip / PCEDLL / MSOFT / PCE32DLL.C next >
Text File  |  1996-10-23  |  1KB  |  83 lines

  1.     #include <windows.h>
  2.  
  3.  
  4. /* I initially thought that i would be able to port straight from
  5.    Borland to Visual C++ without any problem's , HOW WRONG I WAS.
  6.  
  7. _export in VC++ has given way to __declspec( dllexport ) , use it as
  8. shown and you shouldn't have any problem's.
  9. */
  10.  
  11. __declspec( dllexport ) int WINAPI TimesTwo(int x);
  12.  
  13. BOOL WINAPI DllEntryPoint(HINSTANCE  hinstDLL,DWORD  fdwReason,LPVOID  lpvReserved)
  14.  
  15. {
  16.  
  17.  
  18.     switch (fdwReason)
  19.     {
  20.     case DLL_PROCESS_ATTACH:
  21.         {
  22.  
  23.  
  24.  
  25.             break;
  26.         }
  27.  
  28.  
  29.     case DLL_PROCESS_DETACH:
  30.         {
  31.  
  32.  
  33.  
  34.             break;
  35.  
  36.         }
  37.  
  38. case DLL_THREAD_ATTACH:
  39.         {
  40.  
  41.  
  42.  
  43.             break;
  44.         }
  45. case DLL_THREAD_DETACH:
  46.         {
  47.  
  48.  
  49.  
  50.             break;
  51.         }
  52.     
  53.     
  54.     
  55.     
  56.     }
  57.  
  58.  
  59.     return TRUE;
  60.  
  61. }
  62.  
  63.  
  64. /*  THIS IS THE FIRST FUNCTION IN THE DLL , ITS VERY SIMPLE SO EVEN A
  65.      NOVICE SHOULD BE ABLE TO UNDERSTAND IT.
  66.  
  67.   2 PARAMETERS ARE PASSED TO THE FUNCTION , X AND Y ,
  68.   THESE 2 PARAMETERS ARE ADDED TOGETHER , THE RESULT IS PASSED BACK
  69.   TO THE CALLING PROCEDURE.
  70.  
  71.  
  72.  
  73.   */
  74.  
  75.  
  76. __declspec( dllexport )int WINAPI  TimesTwo(int x)
  77. {
  78. // Ive made the Microsoft Visual C++ version return a different sum
  79. // than the borland one , was easier for me during development.
  80.  
  81.     return x * 3;
  82. }
  83.